import { get, post } from '../http'
// 供应商订单列表
export const findSupplierPurchasePage = (paylaod: any) => {
  return get('/procurement/v1/purchase/order/findSupplierPurchasePage', paylaod)
}
// 订单状态数量统计
export const findSupplierPurchaseCountByStatus = (paylaod?: any) => {
  return get('/procurement/v1/purchase/order/findSupplierPurchaseCountByStatus', paylaod)
}
// 接单 /procurement/v1/purchase/order/supplierReceivePurchaseOrder
export const supplierReceivePurchaseOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/order/supplierReceivePurchaseOrder', paylaod)
}
// 创建交货单 /procurement/v1/purchase/order/supplierCreateDeliveryOrder
export const supplierCreateDeliveryOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/order/supplierCreateDeliveryOrder', paylaod)
}

// 交货单列表
export const findSupplierDeliveryPage = (paylaod: any) => {
  return get('/procurement/v1/purchase/delivery/findSupplierDeliveryPage', paylaod)
}
// 交货单状态数量统计
export const findSupplierDeliveryCountByStatus = (paylaod?: any) => {
  return get('/procurement/v1/purchase/delivery/findSupplierDeliveryCountByStatus', paylaod)
}

// 交货单配货 /procurement/v1/purchase/delivery/distributeSupplierDeliveryOrder
export const distributeSupplierDeliveryOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/delivery/distributeSupplierDeliveryOrder', paylaod)
}

// 编辑交货单 /procurement/v1/purchase/delivery/updateSupplierDeliveryOrder
export const updateSupplierDeliveryOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/delivery/updateSupplierDeliveryOrder', paylaod)
}
// 交货单出库 /procurement/v1/purchase/delivery/updateSupplierDeliveryOrder
export const outboundSupplierDeliveryOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/delivery/outboundSupplierDeliveryOrder', paylaod)
}
// 获取交货单详情
export const getSupplierDeliveryInfo = (paylaod?: any) => {
  return get('/procurement/v1/purchase/delivery/getSupplierDeliveryInfo', paylaod)
}

// 删除交货单
export const cancelSupplierDeliveryOrder = (paylaod?: any) => {
  return post('/procurement/v1/purchase/delivery/cancelSupplierDeliveryOrder', paylaod)
}

// -------------------------------供应商报价-----------------------------

// 采购报价列表
export const findSupplierQuotePage = async (paylaod?: any) => {
  return await get('/procurement/v1/purchase/quote/findSupplierQuotePage', paylaod)
    .then((res) => res)
    .catch(() => false)
}

// 采购报价提交审核
export const commitSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/commitSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 采购报价审核
export const auditSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/auditSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 删除采购报价
export const deleteSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/deleteSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 创建采购报价
export const createSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/createSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 更新采购报价
export const updateSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/updateSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 供应商-撤回报价
export const revokeSupplierQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/revokeSupplierQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 供应商-变更报价
export const changeSupplierPurchaseQuote = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/changeSupplierPurchaseQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 供应商-经销商列表
export const findDealerList = async (paylaod?: any) => {
  return await get('/user/v1/supplier/findDealerList', paylaod)
    .then((res) => res)
    .catch(() => false)
}

// -------------------------------报价变更单-----------------------------

//采购报价变更列表
export const findSupplierQuoteChangePage = async (paylaod?: any) => {
  return await get('/procurement/v1/purchase/quote/change/findSupplierQuoteChangePage', paylaod)
    .then((res) => res)
    .catch(() => false)
}
//提交报价变更单
export const commitSupplierQuoteChange = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/change/commitSupplierQuoteChange', paylaod)
    .then((res) => res)
    .catch(() => false)
}
//删除报价变更单
export const deleteSupplierQuoteChange = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/change/deleteSupplierQuoteChange', paylaod)
    .then((res) => res)
    .catch(() => false)
}
//审核报价变更单
export const auditSupplierQuoteChange = async (paylaod?: any) => {
  return await post('/procurement/v1/purchase/quote/change/auditSupplierQuoteChange', paylaod)
    .then((res) => res)
    .catch(() => false)
}
//获取采购报价变更详情
export const getSupplierQuoteChangeInfo = async (paylaod?: any) => {
  return await get('/procurement/v1/purchase/quote/change/getSupplierQuoteChangeInfo', paylaod)
    .then((res) => res)
    .catch(() => false)
}

// 经销商产品 /product/dealer/sku/findDealerProductSkuPage
export const findDealerProductSkuPage = (payload: any) => {
  return post('/product/dealer/sku/findDealerProductSkuPage', payload)
}
